<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script type="text/javascript" src="dist/jquery-easyui-1.5/jquery.min.js" charset="utf-8"></script>
    <script src="dist/jquery-easyui-1.5/jquery.easyui.min.js" charset="utf-8"></script>
    <!--皮肤(全部皮肤)-->
    <link rel="stylesheet" href="dist/jquery-easyui-1.5/themes/default/easyui.css" charset="utf-8">
    <!--引入图标-->
    <link rel="stylesheet" href="dist/jquery-easyui-1.5/themes/icon.css" charset="utf-8">
    <!--引入中文-->
    <script src="dist/jquery-easyui-1.5/locale/easyui-lang-zh_CN.js" charset="utf-8"></script>
</head>

<body>
    <div id="loginDialogForm" title="用户登陆" style="width:250px;height:150px;">
        <form id="loginAct" method="post">
            <table>
                <tr>
                    <th>
                        <label>用户名:</label>
                    </th>
                    <td>
                        <input name="userName" type="text">
                    </td>
                </tr>
                <tr>
                    <th>
                        <label>密&nbsp;码:</label>
                    </th>
                    <td>
                        <input name="password" type="password">
                    </td>
                </tr>
            </table>
        </form>

    </div>
    <script>
        var loginForm;
        $(function () {
            loginForm = $("#loginDialogForm").dialog({
                closable: false,
                modal: true,
                buttons: [{
                    text: '登录',
                    handler: function () {
                       
                        /*第一种
                         *$.ajax({
                              url: "",
                              data: {
                                 "userName":$("#loginAct input[name=userName]"),
                                 "password":$("#loginAct input[name=password]")
                              },
                              cache: false,
                              dataType: "json",
                              success: function (msg) {
                                      if(msg.result=='true'){
                                         
                                      }
                              },
                              error: function (msg) {

                              }
                          });*/
                         // submit the form
                        $('#loginDialogForm').submit();

                    }
			}, {
                    text: '取消',
                    handler: function () {
                        $.messager.alert('Warning', 'The warning message');
                        loginForm.dialog('close');
                    }
			}]
            });
        });

        $('#loginDialogForm').form({
            url: "",
            onSubmit: function () {
                // do some check
                // return false to prevent submit;
            },
            success: function (data) {
                alert(data)
            }
        });
    </script>

</body>

</html>